package com.yanqu.road.server.cmd.activity.huashigang;

import com.yanqu.road.entity.player.UserBaseInfo;
import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.pb.huashigang.HuaShiGangProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.cross.battle.HuaShiGangMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;

@Cmd(code = CrossProtocol.C2_HUA_SHI_GANG_SHEN_XING, desc = "神行千里")
public class CrossShenXingQianLiCmd extends CrossCommand {

    int activityId;
    UserBaseInfo userBaseInfo;
    int type;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        HuaShiGangProto.CrossShenXingQianLiReqMsg msg = HuaShiGangProto.CrossShenXingQianLiReqMsg.parseFrom(packet.getBytes());
        activityId = msg.getActivityId();
        userBaseInfo = PlayerBasePb.parseToUserBaseInfo(msg.getPlayerBaseInfo());
        type = msg.getType();//0 到达下一个精英怪位置 1到达最远的精英怪位置
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        HuaShiGangMgr.shenXing(activityId, serverId, packet.getPlayerId(), userBaseInfo, type);
    }

    @Override
    public void sendData() {

    }
}
